const { DataTypes } = require('sequelize');
const sequelize = require('../db');

exports.settingModel = sequelize.define(
	'setting',
	{
		avatar: {
			type: DataTypes.STRING,
			allowNull: true,
			defaultValue: '/static/source/cat.png'
		},
		siteTitle: {
			type: DataTypes.STRING,
			allowNull: true,
			defaultValue: '未设置 siteTitle'
		},
		github: {
			type: DataTypes.STRING,
			allowNull: true,
			defaultValue: '未设置 github'
		},
		qq: {
			type: DataTypes.STRING,
			allowNull: true,
			defaultValue: '未设置 qq'
		},
		qqQrCode: {
			type: DataTypes.STRING,
			allowNull: true,
			defaultValue: '未设置 qqQrCode'
		},
		weixin: {
			type: DataTypes.STRING,
			allowNull: true,
			defaultValue: '未设置 weixin'
		},
		weixinQrCode: {
			type: DataTypes.STRING,
			allowNull: true,
			defaultValue: '未设置 weixinQrCode'
		},
		mail: {
			type: DataTypes.STRING,
			allowNull: true,
			defaultValue: '未设置 mail'
		},
		icp: {
			type: DataTypes.STRING,
			allowNull: true,
			defaultValue: '未设置 icp'
		},
		githubName: {
			type: DataTypes.STRING,
			allowNull: true,
			defaultValue: '未设置 githubName'
		},
		favicon: {
			type: DataTypes.STRING,
			allowNull: true,
			defaultValue: '未设置 favicon'
		}
	},
	{
		freezeTableName: true,
		deletedAt: true,
		defaultScope: {
			attributes: { exclude: ['createdAt', 'updatedAt'] } // 默认排除 createdAt 和 updatedAt 字段
		}
	}
);
